<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>百商汇</title>
	<meta name="viewport" content="initial-scale = 1.0,maximum-scale = 1.0,minimum-scale = 1.0,user-scalable = no,width = device-width">
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" type="text/css" href="../csses/p.css">
	<script type="text/javascript" src="../lib/jquery-1.10.1.min.js"></script>
</head>
<body>
	<div class="p_title">
		升级合伙人
		<img src="../image/back.png" onclick="goBack()">
	</div>
	<div class="p_box">
		<ul class="ul">
			<li>
				<span>合伙人类别</span>
				<input type="text" placeholder="请选择合伙人类别" readonly="true" id="choose"></input>
			</li>
			<li>
				<span>地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;区</span>
				<input type="text" placeholder="请选择您所在的地区" readonly="true" id="area"></input>
			</li>
		</ul>
		
		<p class="p1">
			公司转账信息如下：<br/>
			公司名称：跃南互联网金融信息服务（上海）有限公司<br/>
			账号及开户行：11015099671004<br/>
			平安银行上海交易所支行
		</p>
		
		<button class="submitBtn">确认</button>

		<p class="agreement">确认即表示同意<a href="partnerAgree.html">《百商汇合伙人合作协议》</a></p>
		
		<div class="hidden_box">
			<ul class="partnerBox">
				<li class="choosePartner">请选择合伙人类别</li>
				<ul class="details">
					<li class="1">全国合伙人 (￥5,000,000)</li>
					<li class="2">省级合伙人 (￥1,000,000)</li>
					<li class="3">市级合伙人 (￥300,000)</li>
					<li class="4">县级合伙人 (￥50,000)</li>
				</ul>
			</ul>
		</div>
	</div>
	
	<div id="remindBox"></div>

	<script type="text/javascript" src="../lib/flexible.js"></script>
	<script type="text/javascript">
		var areaValue = sessionStorage.provinceName1 + ' ' + sessionStorage.cityName1 + ' ' + sessionStorage.areaName1;
		$('#area').val(areaValue);

		function remind(message){
			$('#remindBox').css('display','block').text(message);
			setTimeout(function(){
				$('#remindBox').css('display','none');
			},1500)
		}

		var $hidden_box = $('.hidden_box');
		$('#choose').click(function(){
			$hidden_box.css('display','block');
			if(sessionStorage.partnerLevel == '县级合伙人'){
				$('.details .4').css('display','none');
			}else if(sessionStorage.partnerLevel == '市级合伙人'){
				$('.details .4').css('display','none');
				$('.details .3').css('display','none');
			}else if(sessionStorage.partnerLevel == '省级合伙人'){
				$('.details .4').css('display','none');
				$('.details .3').css('display','none');
				$('.details .2').css('display','none');
			}
		});

		$('.details li').click(function(){
			sessionStorage.partnerText = $(this).text();
			$('#choose').attr('value',$(this).text());
			sessionStorage.partnerLevelNum = $(this).attr('class');
			$hidden_box.css('display','none');
		});
		
		$('.submitBtn').click(function(){
			var $partner = $('#choose').val();
			if(!$partner){
				remind('请选择合伙人类别');
			}else{
				$.ajax({
					type : 'post',
					url : '/api/v1/partner/upgrade',
					data : {
						paramStr : "{'userName':'" + sessionStorage.userName + "','token':'" + sessionStorage.token + "','partnerLevel':'" + sessionStorage.partnerLevelNum + "'}"
					},
					dataType : 'json',
					timeout : 3000,
					success : function (data) {
						remind(data.message);
						if(data.code == 200){
							$('.submitBtn').attr('disabled',true).css('background','#ccc');
							setTimeout(function(){
								window.location.href = '../index1.html#!/personal';
							},1500);
						}
					},
					error : function (xhr,type,errorThrown) {
						// alert('不知道出了什么错...');
					}
				});
			}
		});

		function goBack(){
			window.history.back();
		}
	</script>
</body>
</html>